<template>
  <div class="block">
    <el-carousel height="400px" class="carousel" arrow="hover">
      <el-carousel-item class="item" v-for="item in BannerList" :key="item.id">
        <img class="img" v-img-lazy="item.imgUrl" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script setup>
import { getBannerAPI } from "@/apis/home";
import { onMounted, ref } from "vue";

const BannerList = ref([]);
const getBannerList = async () => {
  const res = await getBannerAPI();
  BannerList.value = res.result;
};
onMounted(() => {
  getBannerList();
});
</script>

<style lang="scss" scoped>
.block {
  position: relative;
  .carousel {
    width: 100%;
  }

  .item {
    .img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>